package CreationalPatterns.Builder.builder;

import CreationalPatterns.Builder.product.Car;
import CreationalPatterns.Builder.components.Engine;
import CreationalPatterns.Builder.product.Suv;
import CreationalPatterns.Builder.components.TripComputer;

public class SuvBuilder implements CarBuilder {
    private Car car;
    private Integer seatNumber = 4;
    private Engine engine = Engine.SUV_ENGINE;
    private TripComputer tripComputer = TripComputer.SUV_TRIP_COMPUTER;

    @Override
    public void reset() {
        this.car = new Suv();
    }

    @Override
    public void setSeats(Integer number) {
        this.seatNumber = number;
    }

    @Override
    public void setEngine(Engine engine) {
        this.engine = engine;

    }

    @Override
    public void setTripComputer(TripComputer tripComputer) {
        this.tripComputer = tripComputer;
    }

    @Override
    public void setSpareTire(Integer number) {
        // Suv一般没有备用轮胎
    }

    @Override
    public Car build() {
        car = new Suv();
        car.setSeatNumber(seatNumber);
        car.setEngine(engine);
        car.setTripComputer(tripComputer);
        return car;
    }
}
